load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "cli",
    srcs = [
        "bash_complete.go",
        "check.go",
        "cli.go",
        "csv_server.go",
        "format.go",
        "run.go",
        "run_unix.go",
        "run_windows.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/workload/cli",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/build",
        "//pkg/cli/exit",
        "//pkg/util/allstacks",
        "//pkg/util/envutil",
        "//pkg/util/log",
        "//pkg/util/log/logconfig",
        "//pkg/util/retry",
        "//pkg/util/timeutil",
        "//pkg/workload",
        "//pkg/workload/histogram",
        "//pkg/workload/workloadsql",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_prometheus_client_golang//prometheus/collectors",
        "@com_github_prometheus_client_golang//prometheus/promhttp",
        "@com_github_spf13_cobra//:cobra",
        "@com_github_spf13_pflag//:pflag",
        "@org_golang_x_time//rate",
    ] + select({
        "@io_bazel_rules_go//go/platform:aix": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:android": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:darwin": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:dragonfly": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:freebsd": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:illumos": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:ios": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:js": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:linux": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:netbsd": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:openbsd": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:plan9": [
            "@org_golang_x_sys//unix",
        ],
        "@io_bazel_rules_go//go/platform:solaris": [
            "@org_golang_x_sys//unix",
        ],
        "//conditions:default": [],
    }),
)

go_test(
    name = "cli_test",
    size = "small",
    srcs = ["format_test.go"],
    embed = [":cli"],
    deps = [
        "//pkg/util/leaktest",
        "//pkg/workload/histogram",
        "@com_github_stretchr_testify//require",
    ],
)
